package com.hhx.androidrxmvp.api;

import com.hhx.androidrxmvp.bean.BaseResp;
import com.hhx.androidrxmvp.bean.Login;

import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Streaming;
import retrofit2.http.Url;

/**
 * pays/pay_money
 * api service
 */
public interface ApiService {

    // 登录的请求personal/change_bg_img
    @FormUrlEncoded
    @POST("login/login")
    Observable<BaseResp<Login>> login(@FieldMap Map<String, String> map);


    //上传图片
    @Multipart
    @POST("upload/index")
    Observable<BaseResp> uploadImage(@PartMap Map<String, RequestBody> map, @Part MultipartBody.Part part);

    /**
     * login/editPassWord
     * 下载图片
     *
     * @return
     */
    @Streaming
    @GET
    Observable<ResponseBody> downloadImage(@Url String fileUrl);
}
